From: Florian Müllner Date: Thu, 29 Jul 2021 19:56:57 +0000 (+0200) Subject: magnifier: Don't query pointer unless necessary X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~574^2^2~161 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=1ea4d72fe5316585578913ba329874a444a1d7f4;p=gnome-shell.git magnifier: Don't query pointer unless necessary The PointerWatcher passes the current pointer position to every watch, so we don't have to query the pointer again scrollToMousePos() is used as watch callback. While that should be the only use, be conservative and still query the pointer when called without arguments. Part-of: --- diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index 08466b9a0..f170bbed0 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -230,8 +230,8 @@ var Magnifier = class Magnifier { * system pointer. * @returns {bool} true. */ - scrollToMousePos() { - let [xMouse, yMouse] = global.get_pointer(); + scrollToMousePos(...args) { + const [xMouse, yMouse] = args.length ? args : global.get_pointer(); if (xMouse != this.xMouse || yMouse != this.yMouse) { this.xMouse = xMouse;